package com.morn.weibo.types;

import java.io.Serializable;

import org.json.JSONException;
import org.json.JSONObject;

import com.morn.weibo.exception.WeiboException;

public class AccountNotification implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 4065489440895188529L;

	private int mentions;

	private int directMessages;

	private int friendRequests;

	public AccountNotification() {

	}

	public AccountNotification(JSONObject json) throws WeiboException {
		init(json);
	}

	private void init(JSONObject json) throws WeiboException {
		if (json != null) {
			try {
				mentions = json.getInt("mentions");
				directMessages = json.getInt("direct_messages");
				friendRequests = json.getInt("friend_requests");
			} catch (JSONException e) {
				throw new WeiboException(
						e.getMessage() + ":" + json.toString(), e);
			}
		}
	}

	public int getMentions() {
		return mentions;
	}

	public void setMentions(int mentions) {
		this.mentions = mentions;
	}

	public int getDirectMessages() {
		return directMessages;
	}

	public void setDirectMessages(int directMessages) {
		this.directMessages = directMessages;
	}

	public int getFriendRequests() {
		return friendRequests;
	}

	public void setFriendRequests(int friendRequests) {
		this.friendRequests = friendRequests;
	}

}
